﻿//-----------------------------------------------------------------------
// <copyright file="DeepZoomCreator.cs" company="Forebrain Technology, LLC">
//
// Copyright (c) Forebrain Technology, LLC. All rights reserved.
// 
// This source code is released under the Microsoft Public License (Ms-PL).
//
// </copyright>
//-----------------------------------------------------------------------
namespace PivotCollectionTools.Library
{
    using System;
    using System.Collections.Generic;
    using System.Security.Permissions;
    using Microsoft.DeepZoomTools;

    /// <summary>
    /// Creats a Deep Zoom collection.
    /// </summary>
    internal sealed class DeepZoomCreator
    {
        /// <summary>
        /// Used to create the Deep Zoom collectio.
        /// </summary>
        private CollectionCreator deepZoomCreator;

        /// <summary>
        /// Initializes a new instance of the <see cref="DeepZoomCreator"/> class.
        /// </summary>
        public DeepZoomCreator()
        {
            this.deepZoomCreator = new CollectionCreator()
            {
                TileFormat = ImageFormat.Jpg,
                TileSize = 256,
                ImageQuality = 0.92,
                MaxLevel = (int)Math.Log(256, 2)
            };
        }

        /// <summary>
        /// Creates the collection from the specified files.
        /// </summary>
        /// <param name="files">The specified files to create the collection from.</param>
        /// <param name="destinationFolder">The destination folder for the Deep Zoom collection.</param>
        [SecurityPermission(SecurityAction.LinkDemand, Unrestricted = true)] 
        public void CreateCollection(ICollection<string> files, string destinationFolder)
        {
            this.deepZoomCreator.Create(files, destinationFolder);
        }
    }
}
